// $Id: config.hpp 2 2009-09-02 08:47:42Z joseph2002 $
/*
 * Copyright 2008-2009 Joseph Wu
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 *
 * For more information, see http://xpcomplus.sourceforge.net
 */

#ifndef XPCOM_API_CONFIG_HPP
#define XPCOM_API_CONFIG_HPP

#include <xpcom/config.hpp>
#include "nspr/config.hpp" // NSPR API config

//
// Platform specific definitions
//
// Win32
#ifdef XPCOM_PLATFORM_WIN32
#  define _NS_IMPORT __declspec(dllimport)
#  define _NS_CALLBACK_(_type, _name) _type (__stdcall * _name)
#  define _NS_FROZENCALL __cdecl

// XXX OS2, not available..
#elif defined(XPCOM_PLATFORM_OS2) && defined(__declspec)
#  define _NS_IMPORT __declspec(dllimport)
#  define _NS_CALLBACK_(_type, _name) _type (* _name)
#  define _NS_FROZENCALL

// Else
#else
#  ifdef XPCOM_HAS_VISIBILITY_ATTRIBUTE // GCC >= 3.3, defined in compiler.hpp
#    define _NS_EXTERNAL_VIS __attribute__((visibility("default")))
#  else
#    define _NS_EXTERNAL_VIS
#  endif

#  define _NS_IMPORT _NS_EXTERNAL_VIS
#  define _NS_CALLBACK_(_type, _name) _type (* _name)
#  define _NS_FROZENCALL

#endif

#ifdef __cplusplus
#  define _NS_EXTERN_C extern "C"
#else
#  define _NS_EXTERN_C
#endif

// _XPCOM_API
// XPCOM library API function declarations.
#define _XPCOM_API(type) \
    _NS_EXTERN_C _NS_IMPORT type _NS_FROZENCALL

#endif // XPCOM_API_CONFIG_HPP
